<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>AngelScript: Private class members</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">AngelScript
   
   </div>
   
  </td>
  
  
  
   
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('doc_script_class_private.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">Private class members </div>  </div>
</div>
<div class="contents">
<div class="textblock"><p>Class members can be declared as private if you wish do not intend for them to be accessed from outside the public class methods. This can be useful in large programs where you to avoid programmer errors where properties or methods are inappropriately used.</p>
<pre>
  // A class with private members
  class MyPrivate
  {
    // The following are public members
    void PublicFunc()
    {
      // The class can access its own private members
      PrivateProp = 0; // OK
      PrivateFunc();   // OK
    }</pre><pre>    int PublicProp;</pre><pre>    // The following are private members
    private void PrivateFunc()
    {
    }</pre><pre>    private int PrivateProp;
  }</pre><pre>  void GlobalFunc()
  {
    MyPrivate obj;</pre><pre>    // Public members can be accessed normally
    obj.PublicProp = 0;  // OK
    obj.PublicFunc();    // OK</pre><pre>    // Accessing private members will give a compiler error
    obj.PrivateProp = 0; // Error
    obj.PrivateFunc();   // Error
  }
</pre> </div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>

    <li class="footer">Generated on Sun Jan 29 2012 15:41:04 for AngelScript by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
